import java.awt.*;
import java.awt.datatransfer.StringSelection;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class TEST {
    public static void main(String[] args) throws AWTException, InterruptedException {
        int index=0;

        String good_id="290946646851";
        String url="https://v3-default.ixigua.com/9bf542a446e5e519a420c6ea5aecf0cc/620131b0/video/tos/cn/tos-cn-ve-15-alinc2/8428f2681e4f4f4ea7b2149c70cc082a/?a=0&br=1522&bt=1522&cd=0%7C0%7C0%7C0&ch=0&cr=0&cs=0&dr=3&ds=3&er=&ft=sYRSY33Gnz7ThhlLxlXq&l=202202052249380102112210471DCA3BF8&lr=&mime_type=video_mp4&net=0&pl=0&qs=0&rc=Mzl2cWk6ZjNkOjMzNGkzM0ApPDU0NTM4ZDw2NzY5Z2c4aWdraWRvcjRnNmtgLS1kLS9zc2M1Xi0vMjYtMzZeLzItMy86Yw%3D%3D&vl=&vr=";
        Robot robot=new Robot();
        robot.setAutoDelay(100);
        robot.mouseMove(-1,-1);
        //菜单
           for (int k=0;k<5;k++){
            robot.mouseMove((int)(1300*1.25),(int)(740*1.25));

           }
           robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
           robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
         //上移(左边)
        for (int k=0;k<5;k++){
           robot.mouseMove((int)(1300*1.25),(int)(480*1.25));
        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);

        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);


        //粘贴并转到().setCo
        StringSelection stsel=new StringSelection(url);https://v3-default.ixigua.com/9bf542a446e5e519a420c6ea5aecf0cc/620131b0/video/tos/cn/tos-cn-ve-15-alinc2/8428f2681e4f4f4ea7b2149c70cc082a/?a=0&br=1522&bt=1522&cd=0%7C0%7C0%7C0&ch=0&cr=0&cs=0&dr=3&ds=3&er=&ft=sYRSY33Gnz7ThhlLxlXq&l=202202052249380102112210471DCA3BF8&lr=&mime_type=video_mp4&net=0&pl=0&qs=0&rc=Mzl2cWk6ZjNkOjMzNGkzM0ApPDU0NTM4ZDw2NzY5Z2c4aWdraWRvcjRnNmtgLS1kLS9zc2M1Xi0vMjYtMzZeLzItMy86Yw%3D%3D&vl=&vr=
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stsel,stsel);
        //空白区https://v3-default.ixigua.com/9bf542a446e5e519a420c6ea5aecf0cc/620131b0/video/tos/cn/tos-cn-ve-15-alinc2/8428f2681e4f4f4ea7b2149c70cc082a/?a=0&br=1522&bt=1522&cd=0%7C0%7C0%7C0&ch=0&cr=0&cs=0&dr=3&ds=3&er=&ft=sYRSY33Gnz7ThhlLxlXq&l=202202052249380102112210471DCA3BF8&lr=&mime_type=video_mp4&net=0&pl=0&qs=0&rc=Mzl2cWk6ZjNkOjMzNGkzM0ApPDU0NTM4ZDw2NzY5Z2c4aWdraWRvcjRnNmtgLS1kLS9zc2M1Xi0vMjYtMzZeLzItMy86Yw%3D%3D&vl=&vr=
        for (int k=0;k<5;k++){
            robot.mouseMove(1575,369);
        }
        //ctrl+v
        Thread.sleep(1000);
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        Thread.sleep(1000);
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_V);
        robot.keyRelease(KeyEvent.VK_V);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        //离开
        for (int k=0;k<10;k++){
            robot.mouseMove(1520,99);
        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        //菜单
        for (int k=0;k<10;k++){
            robot.mouseMove((int)(1300*1.25),(int)(740*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
     //右边
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1445*1.25),(int)(445*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        if (index==0) {
            //搜索栏
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1313 * 1.25), (int) (83 * 1.25));

            }
            robot.delay(300);
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.delay(2200);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            robot.delay(0);
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1360 * 1.25), (int) (117 * 1.25));

            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
//开始下载
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1349 * 1.25), (int) (491 * 1.25));

            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1359 * 1.25), (int) (602 * 1.25));
            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            index++;
        }
       else {
            Thread.sleep(50);
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1223 * 1.25), (int) (78 * 1.25));

            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            Thread.sleep(300);
            //搜索栏
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1313 * 1.25), (int) (83 * 1.25));

            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.delay(2200);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            robot.delay(0);
            Thread.sleep(50);
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1360 * 1.25), (int) (117 * 1.25));

            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
//开始下载
            Thread.sleep(300);
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1349 * 1.25), (int) (491 * 1.25));

            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            Thread.sleep(1000);
            for (int k = 0; k < 5; k++) {
                robot.mouseMove((int) (1359 * 1.25), (int) (602 * 1.25));
            }
            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        }
        Thread.sleep(60*15);

        //菜单
        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1300*1.25),(int)(740*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        //右边
        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1445*1.25),(int)(445*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
//多多视频里操作
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1474*1.25),(int)(652*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        Thread.sleep(300);
        //点视频
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1250*1.25),(int)(195*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        //确认
        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1470*1.25),(int)(680*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
      //带货
        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1500*1.25),(int)(592*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

        //商品id

        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1441*1.25),(int)(159*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1344*1.25),(int)(262*1.25));

        }

        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

        StringSelection stsel2=new StringSelection(good_id);
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stsel2,null);

        Thread.sleep(300);
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_V);
        robot.keyRelease(KeyEvent.VK_V);
        robot.keyRelease(KeyEvent.VK_CONTROL);
       //下一步

        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1291*1.25),(int)(422*1.25));

        }


        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

        //确认
        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1485*1.25),(int)(692*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
        Thread.sleep(300);
        for (int k=0;k<5;k++){
            robot.mouseMove((int)(1480*1.25),(int)(665*1.25));

        }
        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);



       /*
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
       * */

    }
    static void show() throws InterruptedException {
        Thread.sleep(100);
        System.out.println(MouseInfo.getPointerInfo().getLocation().getX()+","+MouseInfo.getPointerInfo().getLocation().getY());

    }
}
